﻿#region import

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using CondeNet.AssetManager.Data;
using CondeNet.AssetManager.Business;
using CondeNet.AssetManager.Business.Interface;

#endregion

namespace CondeNet.AssetManager.DataProvider.Sql.Mappers
{
    public static class AssetContentTypeMapper
    {
        internal static IAssetContentType ToBusinessObject ( T_AssetContentType entity )
        {
            return new AssetContentType (
                entity.AssetContentType_IDPK ,
                entity.Name_NVC ,
                entity.Description_NVC ,
                entity.Enabled_BIT ,
                entity.Width_DC.Value ,
                entity.Height_DC.Value ,
                TypeFunctionsLookup.GetStronglyTypedFunction(entity.TypeFunction_IDFK));
        }

        internal static T_AssetContentType ToEntity ( IAssetContentType v )
        {
            T_AssetContentType entity = new T_AssetContentType ( );

            entity.AssetContentType_IDPK = v.ID;
            entity.Name_NVC = v.Name;
            entity.Description_NVC = v.Description;
            entity.Enabled_BIT = v.Enabled;
            entity.Height_DC = v.Height;
            entity.Width_DC = v.Width;
            entity.TypeFunction_IDFK = TypeFunctionsLookup.GetFunctionId(v.ContentType);
            return entity;
        }

        internal static IList<IAssetContentType> ToBusinessObjects ( IList<T_AssetContentType> dalList )
        {
            return dalList.Select ( tmp => ToBusinessObject ( tmp ) ).ToList ( );
        }

        internal static IList<T_AssetContentType> ToEntities ( IList<IAssetContentType> entityList )
        {
            return entityList.Select ( tmp => ToEntity ( tmp ) ).ToList ( );
        }
    }
}
